package com.wcity.manage.dao.mapper;

import com.wcity.manage.dao.dal.BaseMapper;
import com.wcity.manage.dao.model.Block;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Created by jn on 2016/12/10.
 * 小区dao
 */
@Repository
public interface BlockMapper extends BaseMapper<Block,Serializable> {

    /**
     * 根据区县查询小区信息
     * @param block
     * @param userIds
     * @return
     */
    List<Block> findByBlock(@Param("block") Block block,@Param("userIds")List<Integer> userIds);

    /**
     * 查询小区
     * @param userId
     * @return
     */
    @Select("select id,block_name from td_block where user_id = #{userId}")
    List<Block> findBlockList(int userId);

    /**
     * 获取小区名称list
     * @param userId
     * @return
     */
    @Select(" select block_name from td_block where user_id = #{userId} ")
    List<String> findBlockName(int userId);

    /**
     * 小区列表
     * @param queryMap
     * @return
     */
    List<Block> blockList( Map<String,Object> queryMap );

    /**
     * 批量插入
     * @param list
     * @return
     */
    int insertList(List<Block> list);

    /**
     * 获取到小区信息
     * @param blockId
     * @return
     */
    Block getBlockById( Integer blockId );
}
